import Types from '../mutation-types';


const state = {
	isAppFullPage: false,
	isLoading: false
}

const mutations = {
		[Types.UPDATE_LOADING] (state, status) {
	 		state.isLoading = status
 		},
    [Types.TOGGLE_APP_FULLPAGE](state,isFullpage){
      let bodyCls=document.body.classList
      if(isFullpage==true){
        bodyCls.add('full-page')
        state.isAppFullPage=true;
      }else if(isFullpage===false){
        bodyCls.remove('full-page')
        state.isAppFullPage=false;
      }else{
        bodyCls.toggle('full-page');
        state.isAppFullPage=!state.isAppFullPage;
      }
			if(state.isAppFullPage){
				document.addEventListener('touchmove',stopBodyMove,false)
			}else{
				document.removeEventListener('touchmove',stopBodyMove,false)
			}
    }
}
function stopBodyMove(e){
	e.preventDefault();
}
export default {
	state,
	mutations
}
